<template>
    <div class="userinfo">
    <h3>我是个人信息组件</h3>

    <div>姓名：{{ userName }}</div>

    <div>年龄：{{ age }}</div>

    <div>是否单身：{{ isSingle?'是':'否' }}</div>

    <div>座驾：{{ car.name }}</div>

    <div>兴趣爱好：{{ hobby.join('.') }}</div>

  </div>
  </template>
   
  <script>
  export default {
    // 定义属性接收父组件传值
 
    // props: ['title', 'money', 'car'],
    props: {
      // String, Number, Boolean, Array, Object, Function
      userName:{
        type:String,
        //required:true,
        default:'不知火舞'
      },
      age: {
        type:Number,
        validator(value){
          if(value>=18&&value<=60){
            return true

          }else{
            return false
          }
        }
      },
      isSingle: Boolean,
      car:Object,
      hobby:Array
    },
    data(){
      return {
        count: 0
      }
    },
    methods: {
    
    }
  }
  </script>
   
  <style scoped>
  .box{
    width: 400px;
    height: 300px;
    border: 3px solid pink;
    margin: 20px;
  }
  </style>